<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: 常肖飞先生
  Date: 2022/5/13
  Time: 9:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<%--EL表达式运算符--%>
<h2>算术运算符</h2>

${1+1}<br>
${2-1}<br>
${3*4}<br>
${10/2}<br>
${7%3}<br>

<h2>关系运算符</h2>
${10>3}<br>
${10<3}<br>
${10>=3}<br>
${10<=3}<br>
${10==10}<br>
${10!=10}<br>
<%
pageContext.setAttribute("name", new String("tom"));
session.setAttribute("uname", "tom");
%>
<%--引用数据类型 == 比较实用的是 equals  比较的内容--%>
${"tom" == name}<br>

<h2>逻辑运算符</h2>
${true && false}<br>
${true || false}<br>
${!true}
<h2>三目运算符</h2>
<%--空字符串--%>
${user}
<%--null--%>
<%=session.getAttribute("user")%>
${()}

<h2> empty 判断是否为空的运算符</h2>
<%
    pageContext.setAttribute("pwd", "");
    int[] arr = {};
    pageContext.setAttribute("arr", arr);
    pageContext.setAttribute("arr1", new int[]{1,2});
    pageContext.setAttribute("list", new ArrayList<>());
    List<String> list = new ArrayList<>();
    list.add("a");
    pageContext.setAttribute("list1", list);
%>
${empty user}<br>
${empty uname}<br>
${empty pwd}<br>
${empty arr}<br>
${empty arr1}<br>
${empty list}<br>
${empty list1}<br>




</body>
</html>
